package com.xuchaotong.entity;

import java.util.HashSet;
import java.util.Set;

public class UserTest {
    private static User u = new User();

    public static void main(String[] args) {
        UserTest instance = new UserTest();
//        instance.test();

//        User reUser = instance.test1(u);
//        System.out.println(reUser == u);

        User user = new User(){{
            setName("John");
        }};

        instance.test2();
    }

    public void test(){
        User u1 = u;
        User u2 = u;
        System.out.println(u1 == u2);
    }

    public User test1(User user){
        user.setName("Ryan");

        return user;
    }

    public void test2(){
        User u1 = new User("Ryan");
        User u2 = new User("Ryan");

        Set<User> userSet = new HashSet<>();
        userSet.add(u1);
        userSet.add(u2);

        System.out.println(userSet.size());
    }
}
